package com.iti.jets.gpts.home;

// default package
// Generated Mar 22, 2014 9:41:00 PM by Hibernate Tools 3.4.0.CR1
import com.iti.jets.gpts.dao.AbstractDAO;
import com.iti.jets.gpts.pojo.AttributeType;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import static util.HibernateUtil.getSessionFactory;

/**
 * Home object for domain model class AttributeType.
 *
 * @see .AttributeType
 * @author Hibernate Tools
 */
public class AttributeTypeHome extends AbstractDAO<AttributeType> {

//    private static final Log log = LogFactory.getLog(TerminalHome.class);
    private final SessionFactory sessionFactory = getSessionFactory();

    public AttributeTypeHome(SessionFactory sessionFactory) {
        super(sessionFactory);
    }
        public AttributeType getObject(int id) {
        Criteria criteria = session.createCriteria(AttributeType.class)
                .add(Restrictions.eq("id", id));
        AttributeType attributeType = (AttributeType) criteria.list().get(0);
        return attributeType;

    }
            public boolean isAttributeExist(String name) {
        Criteria criteria = session.createCriteria(AttributeType.class)
                .add(Restrictions.eq("name", name));
        if (criteria.list().size() > 0) {
            return true;
        } else {
            return false;
        }
    }


    

   
}
